//
//  UILabel+label.m
//  App
//
//  Created by huanchi on 15/9/29.
//  Copyright © 2015年  上海欢炽网络科技有限公司. All rights reserved.
//

#import "UILabel+Property.h"

@implementation UILabel (Property)

-(void)labelWithText:(NSString *)text color:(UIColor *)color font:(UIFont*)font{
    [self labelWithText:text color:color font:font textAlign:NSTextAlignmentLeft];
}

-(void)labelWithText:(NSString *)text color:(UIColor *)color font:(UIFont*)font textAlign:(NSTextAlignment)align{
    [self labelWithText:text color:color font:font textAlign:align backgroundColor:[UIColor clearColor]];
}

-(void)labelWithText:(NSString *)text color:(UIColor *)color font:(UIFont *)font textAlign:(NSTextAlignment)align backgroundColor:(UIColor *)backgroundColor {
    self.text = text;
    self.textColor = color;
    self.textAlignment = align;
    self.font = font;
    self.backgroundColor = backgroundColor;
    [self sizeToFit];
}

-(void)cutLayerCornerRadius{
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:self.bounds.size];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    //设置大小
    maskLayer.frame = self.bounds;
    //设置图形样子
    maskLayer.path = maskPath.CGPath;
    self.layer.mask = maskLayer;
}
@end
